package main

import (
	"fmt"
	"math"
	"runtime"
	"strconv"
	"strings"
)

func test01() {
	fmt.Printf("os arch %s,int size %v\n", runtime.GOARCH, strconv.IntSize)
	var a int32 = 260
	fmt.Printf("260\t%b\n", a)
	fmt.Printf("260>>2\t%b\n", a>>2)
	fmt.Printf("260<<2\t%b\n", a<<2)
	fmt.Println("----------------------")
	var b int32 = -260
	fmt.Printf("-260\t%b\n", b)
	fmt.Printf("-260>>2\t%b\n", b>>2)
	fmt.Printf("-260<<2\t%b\n", b<<2)
	fmt.Printf("%U\n", '众')
	fmt.Printf("%d\n", '众')
}
func BinaryFormat(n int32) string {
	a := uint32(n)
	sb := strings.Builder{}
	c := uint32(math.Pow(2, 31))
	for i := 0; i < 32; i++ {		
		if a&c > 0 {
			sb.WriteString("1")
		} else {
			sb.WriteString("0")
		}
		c>>=1
	}
	return sb.String()
}
func main() {
	// test01()
	var a int32=10
	fmt.Println(a, BinaryFormat(a))
	var b int32=-10
	fmt.Println(b, BinaryFormat(b))
}
